package org.zhangjq.myproject;


import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

@Aspect
@Component
public class ApiLogAop {


    @Around(value = "@annotation(ignoreApiValid))")
    public Object aroundAnnotation(ProceedingJoinPoint proceedingJoinPoint,IgnoreApiValid ignoreApiValid) throws Throwable {
        Method method = ((MethodSignature) (proceedingJoinPoint.getSignature())).getMethod();
        IgnoreApiValid ignoreApiValid1 = method.getAnnotation(IgnoreApiValid.class);
        String appKey = ignoreApiValid1.value();
        System.out.println("appKey:" + appKey);
        return proceedingJoinPoint.proceed();
    }


}
